package com.chineseall.rebirth.bridge.zedis;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
 * zedis 服务调用方法
 * @author wbxie
 * 2013-11-20
 */
public class Zedis {

    private final String env;

    public Zedis(String env) {
        this.env = env;
    }

    public String get(String key) {
        return ZedisAdapter.get(env, key);
    }

    public JSONObject getJSONObject(String key) {
        String json = ZedisAdapter.get(env, key);
        return JSON.parseObject(json);
    }

    public <T> T get(String key, Class<T> clazz) {
        return ZedisAdapter.get(env, key, clazz);
    }

    public String post(String key, String val) {
        return ZedisAdapter.post(env, key, val);
    }

}
